<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gerenciamento Escola - Usuários</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/validacao.js" /></script>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="divLogout"><a href="logoutServlet"><c:out value="Logout(${sessionUser.login})"></c:out></a></div>

	<div class="tablegrid">
	
		<table class="tableListUser" >
			<tr height="28px">
				<td class="celListCenter"> <a href="listarProfessores">Professores</a></td>
				<td class="celListCenter"> <a href="listarAlunos">Alunos</a></td>
				<td class="celListCenter"> <a href="listarDisciplinas">Disciplinas</a></td>
				<td class="celListCenter"> <a >Usuários</a></td>
			</tr>
			<tr height="28px">
				<td colspan="4" align="center">Gerenciamento de Usuarios</td>
			</tr>
			<tr>
            	<td align="center"  colspan="2">
                    <a ><img class="icone" src="img/icon/user_search.png"/></a>
                </td>
                <td align="center"  colspan="2" >
                    <a href="usuario"><img class="icone" src="img/icon/user_add.png"/></a>
                </td>
            </tr>
            <tr>
            	<td align="center"  colspan="2">
                    <a >Listar Usuarios</a>
                </td>
                <td align="center"  colspan="2" >
                    <a href="usuario">Adicionar Usuario</a>
                </td>
            </tr>
		</table>			
		<div class="formHeader">Usuários Cadastrados</div>
	

		<div class="erroMsg">
			<c:choose>
				<c:when test="${param.msg eq 'salvo' }">
					Usuário salvo com sucesso
				</c:when>
				<c:when test="${param.msg eq 'removido'}">
					Usuário removido com sucesso
				</c:when>
				<c:when test="${param.msg eq 'erro_remover'}">
					Ocorreu um erro ao remover o usuário
				</c:when>
				<c:when test="${param.msg eq 'erro_salvar'}">
					Ocorreu um erro ao salvar o usuário
				</c:when>
			</c:choose>
		</div>

		<table class="tableListUser">
			<tr class="gridHeader">
				<td>Id</td>
				<td>Login</td>
				<td>Nome</td>
				<td>Email</td>
				<td>Excluir/Editar</td>
			</tr>
			<c:forEach items="${usuarios}" var="user">
				<tr>
					<td class="celListLeft"><c:out value="${user.id}" /></td>
					<td class="celListLeft"><c:out value="${user.login}" /></td>
					<td class="celListLeft"><c:out value="${user.nome}" /></td>
					<td class="celListLeft"><c:out value="${user.email}" /></td>
					<td class="celListCenter">
						<a href="usuario?acao=remover&id=${user.id}" 
						onclick="return confirm('Deseja excluir o usuário?');">
						<img class="iconeListUser" src="img/icon/user_delete.png"></a>  
						<a href="usuario?acao=editar&id=${user.id}">
						<img class="iconeListUser" src="img/icon/user_edit.png"></a></td>
				</tr>
			</c:forEach>
		</table>
	</div>

</body>
</html>